﻿using System;
using System.Web;
using Orchard.DisplayManagement.Implementation;
using Orchard.Environment.Extensions;

namespace Contrib.Mod.AccountWidgets
{
    public class Shapes : IShapeFactoryEvents
    {
        public void Created(ShapeCreatedContext context)
        {
        }

        public void Creating(ShapeCreatingContext context)
        {
        }

        public static bool IsLogOn(ShapeCreatedContext context)
        {
            return context.ShapeType == "LogOn";
        }

        public static bool IsRegister(ShapeCreatedContext context)
        {
            return context.ShapeType == "Register";
        }
    }

    public class AccountShape : IShapeFactoryEvents
    {
        public void Creating(ShapeCreatingContext context)
        {
        }

        public void Created(ShapeCreatedContext context)
        {
            if (Contrib.Mod.AccountWidgets.Shapes.IsLogOn(context))
            {
                context.Shape.Metadata.Wrappers.Add("Wrappers_Account_LogOn");
            }

            if(Contrib.Mod.AccountWidgets.Shapes.IsRegister(context))
            {
                context.Shape.Metadata.Wrappers.Add("Wrappers_Account_Register");
            }
        }
    }
}